package com.general.template.exception;

import com.general.template.enums.ResultEnum;

/**
 * @Author: 杰哥
 * @Description:
 **/
public class GeneralException extends RuntimeException {

    private Integer errorCode = ResultEnum.ERROR.getCode();

    public Integer getErrorCode() {
        return errorCode;
    }

    public GeneralException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.errorCode = resultEnum.getCode();
    }

    public GeneralException(ResultEnum resultEnum, Throwable throwable) {
        super(resultEnum.getMsg(), throwable);
        this.errorCode = resultEnum.getCode();
    }

    public GeneralException(Integer errorCode, String msg) {
        super(msg);
        this.errorCode = errorCode;
    }

    public GeneralException(String message) {
        super(message);
    }

    public GeneralException(String message, Throwable cause) {
        super(message, cause);
    }

    public GeneralException(Throwable cause) {
        super(cause);
    }
}
